<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="q1">
      <input type="button" value="变红" class="bian" />
      <div class="bo">
        <div class="box" ></div>
        <div class="box1" ></div>
        <div class="box2"></div>
      </div>
    </div>
  </body>
  <script>
    let bian = document.querySelector(".bian");
    let box = document.querySelector(".box");
    let box1 = document.querySelector(".box1");
    let box2 = document.querySelector(".box2");
    bian.onclick = function () {
      console.log(1);
        box.style.background = "red";
        box1.style.background = "red";
        box2.style.background = "red";
      }
  </script>
  <style>
    .bian {
      margin-left: 200px;
    }
    .bo {
      display: flex;
    }
    .box {
      margin: 20px;
      width: 100px;
      height: 100px;
      background: #000;
    }
     .box1 {
      margin: 20px;
      width: 100px;
      height: 100px;
      background: #000;
    }
     .box2 {
      margin: 20px;
      width: 100px;
      height: 100px;
      background: #000;
    }
  </style>
</html>
